FROM index.tenxcloud.com/google_containers/ubuntu:14.04

# ssh 
ENV SSH_PASSWORD=zxcasd123 \
    DEBIAN_FRONTEND=noninteractive

RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927 && \
    echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list && \
    apt-get update && \
    apt-get -y install openssh-client openssh-server sshpass wget telnet netcat vim curl python python-pip jq docker unzip nodejs tmux redis-tools mongodb-org-shell=3.2.9 && \
    rm -rf /var/lib/apt/lists/* && \
    pip install redis

RUN mkdir /var/run/sshd

RUN echo "root:${SSH_PASSWORD}" | chpasswd

RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config

# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd

ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile

EXPOSE 22

RUN echo "Asia/Shanghai" > /etc/timezone                                                 
RUN dpkg-reconfigure -f noninteractive tzdata 

